import java.awt.image.renderable.ParameterBlock;
import java.awt.image.*;

import javax.media.jai.*;

import javax.swing.*;


public class comparaHistogramas {

	public comparaHistogramas() {

	}
	public static void main(String[] args) {
		PlanarImage imagem = JAI.create("fileload", "lena.jpg");
		
		//Histograma de 256  --------------------------------------------
		ParameterBlock pb1 = new ParameterBlock();
		pb1.addSource(imagem);
		pb1.add(null);
		pb1.add(1); pb1.add(1);
		pb1.add(new int[]{256});
		pb1.add(new double[]{0}); pb1.add(new double[]{256});
		
		PlanarImage imagem1 = JAI.create("histogram", pb1);
		Histogram histo1 =  (Histogram) imagem1.getProperty("histogram");
		//----------------------------------------------------------------
		
		//Histograma de 32   --------------------------------------------
		ParameterBlock pb2 = new ParameterBlock();
		pb2.addSource(imagem);
		pb2.add(null);
		pb2.add(1); pb2.add(1);
		pb2.add(new int[]{32});
		pb2.add(new double[]{0}); pb2.add(new double[]{256});
		
		PlanarImage h2 = JAI.create("histogram", pb2);
		Histogram histo2 = (Histogram)h2.getProperty("histogram");
		//----------------------------------------------------------------
		
		DisplayHistogram display1 = DisplayHistogram(); 
		
		
		// JANELAS  ------------------------------------------------------
		JFrame frame = new JFrame();
		
		
		
		

	}

}
